#
from itsdangerous import TimedJSONWebSignatureSerializer
from django.conf import settings
# 实例化


class SecretOauth(object):
    def __init__(self):

        self.serializer = TimedJSONWebSignatureSerializer(secret_key=settings.SECRET_KEY,expires_in=3600 * 10)
    # 加密
    def dump(self,data):
        result = self.serializer.dump(data)
        return result.decode()
    #解密
    def loads(self,data):
        result = self.serializer.loads(data)
        return result